<template>
	<view class="index">
		<cu-custom :addHeight="20">
			<block slot="content">简历</block>
		</cu-custom>

		<view class="index-body">
			<block v-if="resumeData.length">
				<resume-list :resumeData="resumeData"></resume-list>
			</block>
			<block v-if="!resumeData.length&&!isLoad">
				<blank-page></blank-page>
			</block>
		</view>

		<view class="big-resume">
			<view class="big-btn" @click="addResumeHandle">
				新建简历
			</view>
		</view>

	</view>
</template>

<script>
	import resumeList from '../../components/resume-list/resume-list.vue';
	import blankPage from '../../components/blank-page/blank-page.vue';
	export default {
		components: {
			resumeList,
			blankPage
		},
		data() {
			return {
				isLoad: true
			}
		},
		computed: {
			resumeData() {
				return this.$store.getters['resume/getResumeData']
			},
			uid() {
				return this.$store.getters['user/getUid']
			},
			isLogin() {
				return this.$store.getters['user/login']
			}
		},
		onLoad() {
			getApp().globalData.successCallbackHander.add(() => {
				this.loadResumeList()
			}, this)
		},
		methods: {
			addResumeHandle() {
				this.$comm.navigateTo("/pages/add-resume/add-resume")
			},
			loadResumeList() {
				return this.$api.getResumeList().then(res => {
					if (res.code) {
						this.$store.commit('resume/setResumeData', res.data)
						this.isLoad = false
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.index {
		min-height: 100vh;
		display: flex;
		flex-direction: column;

		.index-body {
			width: 100%;
			padding-top: 40upx;
			flex: 1;
			height: 0px;
		}

		@include btnStyle;
	}
</style>
